<?php
html::printPath(array('person.form-title' => 'admin/person/all', 'application.page-title-display' => ''));
$msg->printMessages();
echo html::entityInfoIcon('person', $person, 'id');
?>

<div class="commandListFlow ui-helper-clearfix">
	<ul class="commandList">
	    <li class="editLi"><?php echo html::anchor('admin/person/edit?id=' . $person['id'], text::get('person.editThis')) ?></li>
	    <?php
	    if ($person['login']) {
	        echo '<li class="accountCommand">' . html::popupForm('admin/person/accountForm?id=' . $person['id'], text::get('person.accountEdit')) . '</li>';
	        echo '<li class="passwordCommand">' . html::popupForm('admin/person/changePasswordForm?id=' . $person['id'], text::get('person.changePassword')) . '</li>';
	    }
	    else {
	        echo '<li class="accountCommand">' . html::popupForm('admin/person/accountForm?id=' . $person['id'], text::get('person.accountCreate')) . '</li>';
	    }
	    ?>
	    <li class="deleteLi"><?php echo html::anchor('admin/person/delete?id=' . $person['id'], text::get('person.deleteThis'), array('onclick'=>'return confirmDeletion()')) ?></li>
	</ul>
	
	<ul class="commandList">
	    <li class="suCommand"><?php echo html::anchor('admin/userSubstitution/substitute?person_id=' . $person['id'], text::get('admin.menu-userSubstitution')) ?></li>
	    <li class="mergeDuplicatesCommand"><?php echo html::anchor('/admin/person/mergeDuplicatesForm?id=' . $person['id'], text::get('person.mergeDuplicates')) ?></li>
	</ul>
	
	<ul class="commandList">
		<li class="registrationsLi"><?php echo html::anchor('/admin/person/registrationList?id=' . $person['id'], text::get('person.registrationList')) ?></li>
	</ul>
</div>

<?php
$fullName = $person['title'] . ' ' . $person['first_name'] . ' ' . $person['other_names'] . ' ' . $person['last_name'];

$fb = new FormBuilder('person', $person);
$fb->displayOnly();
$fb->display('full_name')->value($fullName)->identifyingValue();
$fb->text('yoga_name');
$fb->radioButtons('gender', array('M','F'), 'person.gender-');
$fb->date('birth_date');

$fb->delimiter(text::get('person-idetificationPapers'));
$fb->comboBox('idcard_type', $idcardTypeOptions);
$fb->text('idcard_number');
$fb->comboBox('citizenship_code', $countryOptions)->hint();

$fb->delimiter(text::get('person-permanentAddress'));
$fb->text('street');
$fb->text('city');
$fb->text('postal_code');
$fb->display('country_code')->value($person['country_name']);

$fb->delimiter();
$fb->display('country_of_residence_code')->value($person['country_of_residence_name']);
$fb->comboBox('preferred_language', form::languageOptions());

$fb->spacer();
$fb->text('telephone');
$fb->text('email');
$fb->yesNoBox('is_ztp');

$fb->spacer();
$fb->text('login');
$fb->yesNoBox('is_admin');
$fb->yesNoBox('is_blocked');
$fb->selectMany('person_tag_ids', $personTagOptions);

$fb->delimiter();
$fb->text('org_name')->labelKey('organization_id');

$fb->spacer();
$fb->textarea('notes');
$fb->submitButton();
$fb->write();